#include <bits/stdc++.h>
using namespace std;
int a[1000005];
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n,s=0,p=0;
    cin>>n;
    for (int i=1;i<=n;i++){
        cin>>a[i];
    }
    sort (a+1,a+n+1);
    for (int i=1;i<=n;i++){
        if (a[i]==1) s++;
        else if(a[i]==2) p++;
    }
    if (s>=p)cout<<s;
    else cout<<p;
    return 0;
}
